import React from 'react'
// ===================================================================== global declare
const { $fn, $http, $Lazy, globalConfig:{COVIDUrl} } = window
// ===================================================================== $Lazy
const Tips 					= $Lazy.load(()=>import('#tp/tips'))
const confirm 				= $Lazy.file(()=>import('@antd/confirm'))
const Modal 				= $Lazy.state(()=>import('@antd/modal'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		specCodes:[]
	}
	submit = {}
	
	open = (uuids,specCodes) => {
		this.submit = {uuids}
		this.setState({specCodes})
		this.modalRef.open()
	}
	render(){
		return (
			<Modal
				title	= '异常报告'
				width 	= {700}
				height  = '40%'
				onRef	= { ref => this.modalRef = ref }
				isFullScroll
				onOk	= {()=>{
					confirm.then(f=>{
						f({
							msg:'确认修改为异常报告？',
							onOk: close => {
								$http.submit(null,COVIDUrl+'caseinfo/reportState',{param:{...this.submit,status:-2}}).then(()=>{
									$fn.msg.success('修改成功')
									this.props.onRefresh()
									close()
									this.modalRef.close()
								})
							}
						})
					})
				}}
			>
				<div className='h fv p-modal'>
					<Tips text='该操作会将以下条码对应选中的报告修改为异常报告，是否确认操作？' className = 'mb5 f14' />
					<div className='f14'>
						{this.state.specCodes.join('，')}
					</div>
				</div>
			</Modal>
		)
	}
}

export default Index